package com.zq.it.dao.impl.admin;

import java.util.Collection;
import java.util.Date;
import java.util.List;

import com.zq.it.dao.admin.AcademyDao;
import com.zq.it.dao.impl.BaseDao;
import com.zq.it.pojo.Academy;

public  class AcademyDaoImpl extends BaseDao<Academy> implements AcademyDao {
  /*public static final Logger logger=t(AcademyDaoImpl.class);*/
	@Override
	public void saveAcademyEty(Academy academty){
    	getHibernateTemplate().save(academty);
	}
	@Override
	public void deleteAcademyEtyByID(Integer id){	
		deleteEntity("delete Academy as adm where adm="+id);
	}

	@Override
	public List<Academy> findAcademyEtyList() {
		return getHibernateTemplate().find("from Academy");
		// TODO Auto-generated method stub
	
	}

	@Override
	public List findAcademyEtyById(Integer id) {
		return getHibernateTemplate().find("from Academy where academyId=?",id);
		// TODO Auto-generated method stub
	
	}

	@Override
	public List findAcademyEtyByName(String name) {
		return getHibernateTemplate().find("from Academy as adm where adm.academyName like '%"+name+"%'");
		// TODO Auto-generated method stub
	
	}

//	@Override
//	public void updateAcademyByID(Integer id) {
//		getHibernateTemplate().update(entity);
//		// TODO Auto-generated method stub
//		
//	}

	@Override
	public void updateAcademyEty(Academy academy) {
		getHibernateTemplate().update(academy);
		// TODO Auto-generated method stub
		
	}
	@Override
	public List findAcademyEtyByDate(Date date){
		// TODO Auto-generated method stub
		return getHibernateTemplate().find("from Academy where createTime=?",date);
	}
	@Override
	public List findAcademyEtyByExmp(Academy academy) {
		// TODO Auto-generated method stub
		return getHibernateTemplate().findByExample(academy);
	}
	@Override
	public void deleteAllEty(java.util.Collection<Academy> collection){
		getHibernateTemplate().deleteAll(collection);
	}
	@Override
	public void deleteAcademyEtyByObj(Academy academy){
		getHibernateTemplate().delete(academy);
	}
	@Override
	public void saveAcademyEtyList(Collection<Academy> collection){
		getHibernateTemplate().saveOrUpdateAll(collection);
	}
	@Override
	public List findAcmyNameAndId() {
		// TODO Auto-generated method stub
		return getHibernateTemplate().find("select academyId,academyName from Academy");
	}
	
}
